<template>
  <div class="container">
    <div class="content">
      <div class="block">
        <div class="title">基本信息</div>
        <div class="row">
          <div class="col">
            <div class="label">用户名</div>
            <div class="text">
              <span v-if="!edit">{{info.name}}</span>
              <el-input
                v-else
                v-model="temp.name"
                placeholder="请输入用户名"
              ></el-input>
            </div>
          </div>
          <div class="col">
            <div class="label">作品数量</div>
            <div class="text">10</div>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <div class="label">手机号</div>
            <div class="text">
              <span v-if="!edit">{{info.mobile}}</span>
              <el-input
                v-else
                v-model="temp.mobile"
                placeholder="请输入手机号"
              ></el-input>
            </div>
          </div>
          <div class="col">
            <div class="label">认证状态</div>
            <div class="text">待认证</div>
          </div>
        </div>
      </div>
      <div class="block">
        <div class="title">实名信息</div>
        <div class="row">
          <div class="col">
            <div class="label">真实姓名</div>
            <div class="text">
              <span v-if="!edit">{{info.name}}</span>
              <el-input
                v-else
                v-model="temp.name"
                placeholder="真实姓名"
              ></el-input>
            </div>
          </div>
          <div class="col">
            <div class="label">身份证号</div>
            <div class="text">
              <span v-if="!edit">{{info.idNo}}</span>
              <el-input
                v-else
                v-model="temp.idNo"
                placeholder="真实姓名"
              ></el-input>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col col2">
            <div class="label">身份证</div>
            <div class="text">

            </div>
          </div>
        </div>
      </div>
      <div class="block">
        <div class="title">专业信息</div>
        <div class="row">
          <div class="col col2">
            <div class="label">擅长风格</div>
            <div class="text">{{info.style}}</div>
          </div>
        </div>
        <div class="row">
          <div class="col col2">
            <div class="label">荣誉或证书</div>
            <div class="text">

            </div>
          </div>
        </div>
        <div class="row">
          <div class="col col2">
            <div class="label">亮点介绍</div>
            <div class="text">
              <span v-if="!edit">{{info.advantageDesc}}</span>
              <el-input
                v-else
                type="textarea"
                :rows="3"
                placeholder="请输入亮点介绍"
                v-model="temp.advantageDesc"
              >
              </el-input>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col col2">
            <div class="label">设计理念</div>
            <div class="text">
              <span v-if="!edit">{{info.designIdea}}</span>
              <el-input
                v-else
                type="textarea"
                :rows="3"
                placeholder="请输入设计理念"
                v-model="temp.designIdea"
              >
              </el-input>
            </div>
          </div>
        </div>
      </div>
      <div class="action">
        <el-button
          v-if="!edit"
          type="primary"
          @click="handleEdit"
        >编辑</el-button>
        <template v-else>
          <el-button
            type="success"
            @click="handleSave"
          >保存</el-button>
          <el-button @click="edit=false">取消</el-button>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      edit: false,
      info: {
        name: '张三',
        mobile: '15888888888',
        idNo: '342516199802457845',
        style: '',
        advantageDesc:
          '如何做好简历中的自我介绍呢?和刚毕业的大学生不一样,我们是工作了多年的具有一定工作经验和人生阅历的军转干部,下面是小编整理的简历自我介绍亮点',
        designIdea:
          '设计理念是设计师在空间作品构思过程中所确立的主导思想,它赋予作品文化内涵和风格特点。好的设计理念至关重要,它不仅是设计的精髓所在,而且能令作品具有个性化、专业化和与众不同的效果。'
      },
      temp: {},
      dto: {
        advantageDesc: '',
        idNo: '',
        style: '',
        certificatePics: ''
      }
    };
  },
  methods: {
    handleEdit() {
      this.temp = JSON.parse(JSON.stringify(this.info));
      this.edit = true;
    },
    handleSave() {}
  }
};
</script>

<style scoped>
.container {
  background: #f0f2f5;
  padding: 25px;
  font-size: 14px;
}
.container .content {
  background: #ffffff;
  padding-bottom: 40px;
}
.block {
  padding: 40px 30px 0 30px;
}
.block .title {
  color: #333;
  font-weight: bold;
  padding-bottom: 15px;
  font-size: 15px;
}
.block .row {
  padding: 10px 0 10px 20px;
  display: flex;
  border-top: 1px solid #f1f1f1;
}

.block .row:last-child {
  border-bottom: 1px solid #f1f1f1;
}

.row .col {
  width: 50%;
  display: flex;
  align-items: center;
  height: 40px;
}
.col .label {
  width: 90px;
  font-weight: bold;
  color: #444;
  flex-shrink: 0;
}
.col .text {
  color: #666;
}

.col.col2 {
  width: 100%;
  min-height: 40px;
  height: auto;
}
.col2 .text {
  flex-grow: 1;
}
.action {
  text-align: center;
  padding: 20px 0;
}
</style>